package com.ajie.controller;


import com.ajie.entity.SysUser;
import com.ajie.service.SysUserService;
import com.ajie.utils.QueryInfo;
import com.ajie.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户数据控制层
 */
@RestController
@Api(tags = "用户数据")
@RequestMapping("/user")
@Slf4j
public class SysUserController {

    @Autowired
    private SysUserService userService;


    @ApiOperation(value = "分页查询")
    @PostMapping("/findPage")
    public Result findPage(@RequestBody QueryInfo queryInfo){
        log.info("该文件名是：SysUserController,该方法是：findPage");
        return userService.findPage(queryInfo);
    }

    @ApiOperation(value = "添加用户")
    @PostMapping("/insert")
    public Result insert(@RequestBody SysUser user){
        log.info("该文件名是：SysUserController,该方法是：insert");
        return userService.insert(user);
    }

    @ApiOperation(value = "删除用户")
    @DeleteMapping("/delete/{id}")
    public Result delete( @PathVariable("id") Long id){
        log.info("该文件名是：SysUserController,该方法是：delete");
        return userService.delete(id);
    }

    @ApiOperation(value = "修改用户")
    @PutMapping("/update")
    public Result update(@RequestBody SysUser user){
        log.info("该文件名是：SysUserController,该方法是：update");
        return userService.update(user);
    }
    
    @ApiOperation(value = "分页查询专家信息")
    @PostMapping("/findExpert")
    public Result findExpert(@RequestBody QueryInfo queryInfo){
        log.info("该文件名是：SysUserController,该方法是：findExpert");
        return userService.findExpert(queryInfo);
    }
    
    
    
    
   
    
}
